//
//  MenuCollectionViewCell_OnlyImage.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2020/10/9.
//  Copyright © 2020 moon. All rights reserved.
//

#import "MenuCollectionViewCell_OnlyImage.h"
#import "Menu.h"
@implementation MenuCollectionViewCell_OnlyImage
- (id)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        self.menuIconView = [[UIImageView alloc] init];
        self.menuIconView.contentMode = UIViewContentModeScaleAspectFit;
        [self.contentView addSubview:self.menuIconView];
    }
    return self;
}
- (void)_menuButtonDidTap:(id)sender{
    [self.collectionCellModel didClickSelf];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    CGRect bounds = self.contentView.bounds;
    self.menuIconView.frame = bounds;
}
- (void)setCollectionCellModel:(__kindof MKUICollectionViewCellModel *)collectionCellModel{
    [super setCollectionCellModel:collectionCellModel];
    Menu *menu = self.collectionCellModel.modelValue;
    if(!menu){
        return;
    }
    self.menuIconView.image = menu.icon;
}
@end
